#!/bin/sh
#
# scpFile.sh
#

if [ $# != 4 ];then
  echo "Usage: scpFile.sh nodeIp username file renameFile"
  exit 1;
fi

nodeip=$1
username=$2
file=$3
renameFile=$4

chown -R $username.$username $file

su $username -c "scp $file $nodeip:$renameFile"

if [ $? -ne 0 ]; then
	exit 100
fi

exit 0
